package com.example.proxy.demo1.impl;

import com.example.proxy.demo1.IUserService;

import java.util.Collections;
import java.util.List;

public class UserServiceProxy implements IUserService {

    private IUserService target;

    public UserServiceProxy(IUserService target) {
        this.target = target;
    }

    @Override
    public void saveUser() {
        System.out.println("开启事务");
        target.saveUser();
        System.out.println("关闭事务");
    }

    @Override
    public List<String> getUserList() {
        return Collections.singletonList("张三");
    }
}
